package library;

import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.text.DateFormat;
import java.text.NumberFormat;
import java.util.GregorianCalendar;

import javax.swing.JFormattedTextField;
import javax.swing.JPanel;
import javax.swing.JTextField;

import user_client.LibrarianUserClient;

public class EditionBookPane extends JPanel {

	private Integer isbn = 0;
	private String nameOfEditionHouse = "";
	private GregorianCalendar dateOfPublishing;
	private String title = "";
	private Integer idOfDepartment = null;
	private String[] names = new String[4];
	
	
	private NumberFormat isbnFormat;
	private DateFormat dateOfPublishingFormat;
	private JPanel mainArea = null;
	private LibrarianUserClient client = null;
	
	
	public EditionBookPane(LibrarianUserClient client,
			Integer isbn, String nameOfEdition, JPanel mainArea) {
		
		this.setLayout(new BorderLayout());
		
		names[0] = "isbn:";
		names[1] = "nazwa wydawnictwa:";
		names[2] = "data wydania:";
		names[3] = "tytuł:";
		
		
		initFormats();
		
		TextPane pane = new TextPane(names,
				new JFormattedTextField(isbnFormat),
				new JTextField(),
				new JFormattedTextField(dateOfPublishingFormat),
				new JTextField());
		
		this.add(pane);
		pane.getField("isbn:").setText("0000000000000");
		
		
		// TODO Auto-generated constructor stub
	}
	
	private void initFormats(){
		isbnFormat = NumberFormat.getIntegerInstance();                 
		dateOfPublishingFormat = DateFormat.getDateInstance(DateFormat.SHORT);  
		isbnFormat.setMinimumIntegerDigits(13);
		isbnFormat.setMaximumIntegerDigits(13);
		
	}
}
